package leetcode.每日一题;

import org.junit.Test;

import java.util.*;

/**
 * @author ：zsy
 * @date ：Created 2021/10/30 14:28
 * @description：
 */
public class 整数反转 {
    @Test
    public void test() {
        Solution solution = new Solution();
    }


    class Solution {
        public int reverse(int x) {
            int res = 0;
            while (x != 0) {
                if (res < Integer.MIN_VALUE / 10 || res > Integer.MAX_VALUE / 10) return 0;
                int num = x % 10;
                x /= 10;
                res = res * 10 + num;
            }
            return res;
        }
    }
}
